package com.punch.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.punch.common.vo.user.user.UserExtendVO;
import com.punch.user.mapper.SysUserOrganMapper;
import com.punch.user.model.SysUserOrgan;
import com.punch.user.service.UserOrganService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;


@Service
public class UserOrganServiceImpl extends ServiceImpl<SysUserOrganMapper, SysUserOrgan> implements UserOrganService {

    /**
     * 获取机构结算信息
     *
     * @param userId 用户uid
     * @return UserExtendVO
     */
    @Override
    public UserExtendVO getUserSettlement(Long userId) {
        QueryWrapper<SysUserOrgan> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(SysUserOrgan::getUserId, userId);
        SysUserOrgan sysUserOrgan = getOne(queryWrapper);
        UserExtendVO userExtendVO = new UserExtendVO();
        BeanUtils.copyProperties(sysUserOrgan, userExtendVO);
        return userExtendVO;
    }
}